#include<stdio.h>
#include<unistd.h>
#include<stdlib.h>
int tval = 10;
int main(){
	pid_t id = fork();
	int val = 10;
	if(!id)
	{
		int count = 0;
		while(1){
			printf("my child val = %d valp = %p tval = %d tvalp = %p\n",val, &val,tval,&tval );
			if(count == 10){
				val = 99;
				tval = 99;
				printf("child change val = %d\n", val);
				printf("child change tval = %d\n", tval);
			}
			count++;
			sleep(1);
		}
	}
	else if(id>0){
		while(1){
			printf("my parents val = %d valp = %p tval = %d tvalp = %p\n",val,&val,tval ,&tval);
			sleep(1 );
		}
	}
	else
	{
		printf("fork error ");
		exit(-1);
	}
	return 0;
}
